//不要给我WA WA 叫
//一定AC
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iomanip>
#include <climits>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N = 1e5 + 10;
int a[N];
void solve()
{
 /*    int n;
    cin >> n;
    set<int> st;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            st.insert(i ^ j);
        }
    }
    int m = 1;
    while(st.count(m))
    {
        m++;
    }
    cout << m << endl; */
    int n;
    cin >> n;
    if(n == 1 || n == 2)
    {
        cout << "1" << endl;
        return;
    }
    int ant = 0;
    n--;
    while(n)
    {
        n /= 2;
        ant++;
    }
   // cout << pow(2,ant) << endl;  处理浮点数double时更好，不合适可能会导致精度问题，尤其是在处理大数时
    cout << (1ll << ant) << endl; //返回的是一个长整型（long long），适合处理整数，且不会有精度问题
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t;
    cin >> t;
    while(t -- )  solve();
    return 0;
}



